<template>
  <HuilanBasic>
    <HuilanBasicToolbar style="margin-top: 0">
      <el-button type="primary" size="small" @click="handleAdd"
        >{{ $t("aicosCommon.addBtn") }}
      </el-button>
    </HuilanBasicToolbar>
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      :page="page"
      ref="crud"
      v-model="form"
      :before-open="beforeOpen"
      @row-del="rowDel"
      @row-update="rowUpdate"
      @row-save="rowSave"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
    </avue-crud>
  </HuilanBasic>
</template>

<script>
export default {
  data() {
    return {
      form: {},
      page: {
        pageSize: 10,
        pageSizes: [10, 30, 50, 100, 200],
        currentPage: 1,
        total: 0,
      },
      loading: false,
      data: [],
      option: {
        header: false,
        height: "auto",
        searchShow: false,
        border: true,
        index: true,
        menuBtn: true,
        viewBtn: false,
        menuAlign: "center",
        editBtn: true,
        addBtn: false,
        menuWidth: 160,
        labelWidth: 120,
        dialogClickModal: false,
        delBtn: true,
        dialogWidth: "40%",
        dialogType: "drawer",
        dialogCustomClass: "huilan-drawer-form",
        column: [
          {
            label: "厂商来源",
            prop: "searchType",
            type: "select",
            dicData: [
              {
                label: "支付宝",
                value: "1",
              },
              {
                label: "微信",
                value: "2",
              },
              {
                label: "汇联",
                value: "3",
              },
            ],
          },
          {
            label: "能力名称",
            prop: "title",
          },
          {
            label: "支持训练",
            prop: "isTrain",
          },
          {
            label: "更新时间",
            prop: "updateTime",
          },
          {
            label: "描述",
            prop: "description",
          },
        ],
      },
    };
  },
  mounted() {},
  methods: {
    onLoad() {
      this.data = [
        {
          title: "身份信息查询",
          searchType: "3",
          isTrain: "否",
          updateTime: "2024-10-16 10:46:53",
          description: "查询身份证信息",
        },
        {
          title: "电子证照服务",
          searchType: "3",
          isTrain: "是",
          updateTime: "2024-10-16 10:43:01",
          description: "电子证照服务",
        },
        {
          title: "寄递服务",
          searchType: "3",
          isTrain: "是",
          updateTime: "2024-10-15 17:45:03",
          description: "寄快递",
        },
      ];
    },
    handleAdd() {
      this.$refs.crud.rowAdd();
    },
  },
};
</script>

<style scoped lang="scss">
</style>
